<?php
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//首页二手房列表
Route::get('secondHouse/list', 'Api\SecondHandHouseController@secondIndexList');
//获取直播地址
Route::get('live/getPullUrl', 'Api\LiveController@getPullUrl');
//直播回调
Route::post('live/notify', 'Api\LiveController@notifyUrl');
//录播回调
Route::post('live/playback/notify', 'Api\LiveController@recordNotify');

Route::group([ 'namespace' => 'Api','prefix'=>'wx'],function () {
    //登录获取token
    Route::post('login', 'WxLogin@WeChatLogin');
    //刷新token
    Route::post('refresh', 'WxLogin@refreshToken');
    //获取token
    Route::post('agent/login','WxLogin@agentLogin');
});

//防刷
Route::group(['middleware' => 'throttle', 'namespace' => 'Api'], function () {
    //授权登录
    Route::post('wx/userInfo', 'WxLogin@userInfo');
    //经纪人授权
    Route::post('wx/agentInfo', 'WxLogin@agentInfo');
    //经纪人端发送验证码
    Route::post('send/sms', 'WxLogin@sendSms');
    //经纪人端短信登录
    Route::post('phone/login', 'WxLogin@phoneLogin');
    //求租/求购
    Route::post('home/asksfor', 'HouseController@asksForHouse');
    //求租/求购列表
    Route::get('home/asksfor/list', 'HouseController@askforList');
    //轮播图API
    Route::get('slides','HomeController@getSlideShow');
    //快捷入口
    Route::get('quick/entrance','QuickEntranceController@getQuickEntrance');
    Route::prefix('user')->group(function () {
        //用户定位
        Route::get('local', 'HomeController@getAddress');
        //获取平台用户所有求购列表
        Route::get('buy/list','UserReleaseController@getBuyList');
    });
    Route::prefix('city')->group(function () {
        Route::get('id', 'CityController@getDataById');
        //根据定位获取对应ID
        Route::get('province', 'CityController@getProvinceId');
        //获取全部省会
//        Route::get('provinces', 'CityController@getProvince');
        //根据定于获取对应区域
        Route::get('regions', 'CityController@getRegions');
    });

    Route::prefix('wx')->group(function () {
        //根据ID获取wx用户信息
        Route::get('user', "WxUserController@getUser");
        //签到
        Route::post('sign', "WxUserController@sign");
    });
    Route::prefix('agent')->group(function () {
        //根据ID
        Route::get('agent', 'AgentController@getAgentInfo');
        //首页经纪人列表
        Route::get('list', 'AgentController@agentList');
        //首页经纪人详情信息
        Route::get('desc', 'AgentController@agentDesc');
    });
    Route::prefix('fang')->group(function () {
        //楼市圈接口
        Route::get('circle', 'FangCircleController@getlist');
        //房源发布 获取属性
        Route::get('attress', 'FangReleaseController@outRentFangAttr');
        //出租房发布保存
        Route::post('outRent/create', 'FangReleaseController@outRentCreate');
    });
    //直播
    Route::prefix('live')->group(function () {
        //经纪人发起直播
        Route::post('recording/create','LiveController@createRecording');
        //经纪人获取直播推流地址
        Route::get('recording/edit','LiveController@edit');

        //获取直播记录列表
        Route::get('list','LiveController@liveList');
    });
    Route::prefix('order')->group(function () {
        //订单创建
        Route::post('create', 'OrderController@create');
    });
    //解密获取ID
    Route::get('decode', 'WxUserController@getId');
    Route::prefix('secondHouse')->group(function (){
        //首页二手房列表
        Route::get('list', 'SecondHandHouseController@secondIndexList');
        //根据方式ID获取对应二手房列表
        Route::get('type/list', 'SecondHandHouseController@secondBySaleType');
        //根据ID获取对应二手房信息
        Route::get('id', 'SecondHandHouseController@secondById');
        //获取配套设置信息
        Route::get('config','FangAttrController@getAttrById');
        //定期同步redis
        Route::post('db/redis','SecondHandHouseController@toRedis');
        //范围查询周围内房源
        Route::get('house','SecondHandHouseController@findHouse');
        //地图找房详情页
        Route::get('map/detail','SecondHandHouseController@findByMap');
        //搜索条件 售价
        Route::get('search/price','SecondHandHouseController@getPrices');
        //搜索条件 户型
        Route::get('search/type','SecondHandHouseController@getFangType');
        //搜索条件 朝向
        Route::get('search/forward','SecondHandHouseController@getFangForward');
        //搜索条件 装修
        Route::get('search/fit','SecondHandHouseController@getFangFit');
        //符合条件查询二手房源
        Route::get('search/fang','SecondHandHouseController@getFang');
    });
    Route::prefix('building')->group(function () {
        //首页热门楼盘列表
        Route::get('hot', 'BuildingController@hotBuilding');
        //楼盘列表
        Route::get('buildings', 'BuildingController@buildings');
        //根据楼盘ID获取新房信息
        Route::get('house/id', 'NewHouseCOntroller@getByBid');
        //根据ID获取楼盘信息
        Route::get('building', 'BuildingController@building');
    });

    //验证用户登录
    Route::group(['middleware' => ['LoginCheck']], function () {
        //团购看房
        Route::get('pink/list','PinkController@pinkList');
        //用户参团
        Route::post('pink/join','PinkController@joinPink');
        //经纪人发布团购记录
        Route::get('pink/agent','PinkController@agentPink');
        //经纪人创建团购
        Route::post('pink/creation','PinkController@pinkCreate');
        //经纪人修改团购状态
        Route::post('pink/alter','PinkController@pinkUpdateStatus');
        //收藏
        Route::post('collect','HouseController@collect');
        //取消收藏
        Route::post('cancel','HouseController@cancelCollect');
        //是否收藏
        Route::post('isCollect','HouseController@isCollect');
        //浏览记录
        Route::post('browse','HouseController@browseHistory');
        Route::prefix('user')->group(function () {
            //首页热门楼盘列表
            Route::get('consume/list', 'WxUserController@getUserConsumeList');
        });
        //支付 william
        Route::prefix('pay')->group(function () {
            Route::post('to', 'PayController@pay');
        });
    });
    //资讯
    Route::prefix('news')->group(function () {
        //首页资讯列表
        Route::get('list', 'NewsController@list');
        //首页经纪人详情信息
        Route::get('detail', 'NewsController@detail');
    });
    //经纪人
    Route::prefix('agent')->group(function () {
        //根据ID
        Route::get('agent', 'AgentController@getAgentInfo');
        //首页经纪人列表
        Route::get('list', 'AgentController@agentList');
        //经纪人详情信息
        Route::get('desc', 'AgentController@agentDesc');
    });
});

//上传图片
Route::post('upfile','Api\TestController@upfile');

Route::get('city','Api\FangReleaseController@data');
Route::get('shi','Api\FangReleaseController@shi');
Route::get('qu','Api\FangReleaseController@qu');


